package io.starteos.wallet.utils.eos.data.remote.model.types;

import javax.persistence.Transient;

import com.google.gson.annotations.Expose;

import io.starteos.wallet.utils.eos.crypto.util.HexUtils;
import io.starteos.wallet.utils.eos.data.remote.model.types.EosType.Writer;

public class EosAddCoins  implements EosType.Packer{
	@Transient
	@Expose
	private TypeAccountName account;
	@Transient
	@Expose
	private TypeCoins coins;
	
	public EosAddCoins(String account, String coins) {
		this.account = new TypeAccountName(account);
		this.coins = new TypeCoins(coins);
	}
	
	public String getActionName() {
		return "addcoins";
	}

	@Override
	public void pack(Writer writer) {
		account.pack(writer);
		writer.putLongLE(coins.getCoins());
	}
	
	public String getAsHex() {
		EosType.Writer writer = new EosByteWriter(256);
		pack(writer);

		return HexUtils.toHex(writer.toBytes());
	}
}
